<style>
    .form-horizontal .control-label { width: 200px; }
</style>
<div class="container">

    <div class="row">

        <div class="span12">

            <form class="form-horizontal" id="editObjectDialog_form" method="post" action="<?=base_url('objects/submit_post')?>" name="editObjectDialog_form">

                <fieldset>

                    <input type="hidden" value="<?=$post_action;?>" name="editObjectDialog_post_action" id="editObjectDialog_post_action">    
                    <? if($post_action=='EDIT'){?><input type="hidden" value="<?=$object['ID'];?>" name="editObjectDialog_post_ID" id="editObjectDialog_post_ID"><?} ?>

                    <div class="group">

                        <span class="group-title apartment hidden"> GENERAL &nbsp;&nbsp;                            
                            <a id="trgr_addAttr" href="#" title="Add attribute" onclick="addAttributeDialog(base_url+'object_attributes/view_new/apartment'); return false;"><i class="icon-plus"></i> Add attribute</a>&nbsp;&nbsp; 
                            <a id="trgr_editAttr" href="#" title="Edit attribute" onclick="editAttributesDialog(base_url+'object_attributes/view_edit/apartment'); return false;"><i class="icon-wrench"></i> Edit attribute</a>&nbsp;&nbsp; 
                        </span>
                        <span class="group-title hotel hidden"> GENERAL &nbsp;&nbsp;                            
                            <a href="#" title="Add attribute" onclick="addAttributeDialog(base_url+'object_attributes/view_new/hotel'); return false;"><i class="icon-plus"></i> Add attribute</a>&nbsp;&nbsp; 
                            <a href="#" title="Edit attribute" onclick="editAttributesDialog(base_url+'object_attributes/view_edit/hotel'); return false;"><i class="icon-wrench"></i> Edit attribute</a>&nbsp;&nbsp;
                        </span>
                        <span class="group-title villa hidden"> GENERAL &nbsp;&nbsp;                            
                            <a href="#" title="Add attribute" onclick="addAttributeDialog(base_url+'object_attributes/view_new/villa'); return false;"><i class="icon-plus"></i> Add attribute</a>&nbsp;&nbsp; 
                            <a href="#" title="Edit attribute" onclick="editAttributesDialog(base_url+'object_attributes/view_edit/villa'); return false;"><i class="icon-wrench"></i> Edit attribute</a>&nbsp;&nbsp;
                        </span>

                        <fieldset>    

                        <div class="control-group">
                            <label class="control-label">Select type:</label>
                            <div class="controls docs-input-sizes">

                                <select class="span3" name="editObjectDialog_object_type" id="editObjectDialog_object_type">
                                    <option value="0">--Please Select</option>
                                    <option value="apartment">Apartment</option>
                                    <option value="hotel">Hotel</option>
                                    <option value="villa">Villa</option>

                                </select>

                            </div>
                        </div>

                        <div class="control-group">
                            <label class="control-label">Select destination:</label>
                            <div class="controls docs-input-sizes">

                                <select class="span3" name="editObjectDialog_destination" id="editObjectDialog_destination">
                                    <option value="0">--Please Select</option>
                                    <? foreach($destinations as $destination): ?>
                                        <option value="<?=$destination['ID']?>"><?=$destination['post_title'];?></option>
                                        <?
                                            $childrens = $this->objects_model->view_post_children($destination['ID'],'resort');
                                            foreach($childrens as $children): ?>
                                            <option value="<?=$children['ID']?>"><?='-- '.$children['post_title'];?></option>
                                            <? endforeach; ?>
                                        <? endforeach; ?>

                                </select>

                                <a class="btn btn-mini" title="New Destination"><i class="icon-plus"></i></a>

                            </div>
                        </div>

                        <div class="control-group">
                            <label class="control-label">Select suplier:</label>
                            <div class="controls docs-input-sizes">

                                <select class="span2" name="editObjectDialog_owner" id="editObjectDialog_owner">
                                    <option value="0">--Please Select</option>
                                    <? foreach($owners as $owner): ?>
                                        <option value="<?=$owner['ID']?>"><?=$owner['name'].' '.$owner['surname'];?></option>
                                        <? endforeach; ?>

                                </select>

                                <a class="btn btn-mini" title="New Suplier"><i class="icon-plus"></i></a>
                                <a class="btn btn-mini hide" title="Edit suplier"><i class="icon-wrench"></i></a>

                            </div>
                        </div>

                        <div id="data-container"> </div>

                        <div class="status_info"></div>

                    </div>

                </fieldset>
            </form>

        </div>

    </div>

</div> <!-- /container --> 

<script type="text/javascript"> 

    // populate values if edit mode
    <?if($post_action=='EDIT'):?>            


        var editObjectDialog_object_type = '<?=$object['type']?>';
        var editObjectDialog_owner = '<?=$object['owners_ID']?>';
        var editObjectDialog_post_ID = '<?=$object['ID']?>';


        <?endif;?>

</script>